import { FormSchema, commonRules } from '@/components/Form';
import { getDictOptions } from '@/utils/dict';
import { DictEnum } from '@/enums/dictEnum';
import { IconEnum } from '@/enums/appEnum';
import { useRender } from '@/hooks/component/useRender';
const { renderIcon } = useRender();
export const drawerSchemas: FormSchema[] = [
  {
    label: '联系人id',
    field: 'contactId',
    component: 'Input',
    show: false,
    required: false,
  },
  {
    label: '客户id',
    field: 'customerId',
    component: 'Input',
    show: false,
    required: false,
  },
  {
    label: '供应商id',
    field: 'vendorId',
    component: 'Input',
    show: false,
    required: false,
  },
  {
    label: '姓名',
    field: 'contactName',
    component: 'Input',
    required: true,
  },
  {
    label: '邮箱',
    field: 'contactEmail',
    component: 'Input',
    rules: commonRules('email', true),
    renderComponentContent() {
      return {
        addonBefore: () => renderIcon(IconEnum.EMAIL),
      };
    },
  },
  {
    label: '联系电话',
    field: 'contactTel',
    component: 'Input',
    rules: commonRules('phone', true),
    renderComponentContent() {
      return {
        addonBefore: () => renderIcon(IconEnum.PHONE),
      };
    },
  },
  {
    label: '职务',
    field: 'contactJob',
    component: 'Input',
    required: true,
  },
  {
    label: '生日',
    field: 'contactBirthDay',
    required: false,
    component: 'DatePicker',
    componentProps: {
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '用户性别',
    field: 'contactSex',
    defaultValue: '0',
    component: 'RadioGroup',
    componentProps: {
      options: getDictOptions(DictEnum.SYS_USER_SEX),
    },
  },
  {
    label: '社交账号',
    field: 'contactSocialAccount',
    slot: 'contactSocialAccount',
    itemProps: {
      autoLink: false,
    },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'InputTextArea',
    componentProps: {
      rows: 2,
    },
  },
  {
    label: '主联系人',
    field: 'contactIsMain',
    component: 'Checkbox',
  },
];
